<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Priithon.useful</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Priithon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/priithon">Priithon</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Priithon-module.html">Package&nbsp;Priithon</a> ::
        Module&nbsp;useful
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Priithon.useful-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module useful</h1><p class="nomargin-top"><span class="codelink"><a href="Priithon.useful-pysrc.html">source&nbsp;code</a></span></p>
<p>Priithon U modules: lot's of simple 'useful' (shortcut) functions</p>

<hr />
<div class="fields">      <p><strong>Author:</strong>
        Sebastian Haase &lt;seb.haase+Priithon@gmail.com&gt;
      </p>
      <p><strong>License:</strong>
        BSD license - see LICENSE file
      </p>
</div><!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Priithon.useful.deco_memoized-class.html" class="summary-name">deco_memoized</a><br />
      Decorator that caches a function's return value each time it is called.
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="myStr"></a><span class="summary-sig-name">myStr</span>(<span class="summary-sig-arg">a</span>)</span><br />
      like str()  but calls str() recursively for lists and tuples</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#myStr">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_fixDisplayHook"></a><span class="summary-sig-name">_fixDisplayHook</span>()</span><br />
      change default displayHook: print .3 instead of .299999</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_fixDisplayHook">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#_execPriithonRunCommands" class="summary-sig-name" onclick="show_private();">_execPriithonRunCommands</a>()</span><br />
      http://en.wikipedia.org/wiki/Run_Commands
Rc stands for the phrase &quot;run commands&quot;
It is used for any file that contains startup information for a command.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_execPriithonRunCommands">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_getRCfile"></a><span class="summary-sig-name">_getRCfile</span>()</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getRCfile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#getHomeDir" class="summary-sig-name">getHomeDir</a>(<span class="summary-sig-arg">defaultToCwd</span>=<span class="summary-sig-default">False</span>)</span><br />
      Try to find user's home directory, otherwise return current 
      directory.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#getHomeDir">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#_getSourceCodeLine" class="summary-sig-name" onclick="show_private();">_getSourceCodeLine</a>(<span class="summary-sig-arg">depth</span>=<span class="summary-sig-default">0</span>)</span><br />
      return &quot;current&quot; line number of source code  inside py-file</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeLine">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#_getSourceCodeFilename" class="summary-sig-name" onclick="show_private();">_getSourceCodeFilename</a>(<span class="summary-sig-arg">numPathTails</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">depth</span>=<span class="summary-sig-default">0</span>)</span><br />
      return &quot;current&quot; filename of py-file 
if numPathTails:
    split off all leading folder before the last numPathTails parts,
    and return only those remaining parts;
    e.g.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeFilename">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#_getSourceCodeFuncName" class="summary-sig-name" onclick="show_private();">_getSourceCodeFuncName</a>(<span class="summary-sig-arg">depth</span>=<span class="summary-sig-default">0</span>)</span><br />
      return &quot;current&quot; function name</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeFuncName">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#_getSourceCodeLocation" class="summary-sig-name" onclick="show_private();">_getSourceCodeLocation</a>(<span class="summary-sig-arg">numPathTails</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">depth</span>=<span class="summary-sig-default">0</span>)</span><br />
      return &lt;filename&gt;:&lt;lineNo concatenating the results of 
      _getSourceCodeFilename  and _getSourceCodeLine</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeLocation">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_raiseRuntimeError"></a><span class="summary-sig-name">_raiseRuntimeError</span>(<span class="summary-sig-arg">msg</span>,
        <span class="summary-sig-arg">appendSourceCodeLocation</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">numPathTails</span>=<span class="summary-sig-default">None</span>)</span><br />
      use this only inside an except clause</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_raiseRuntimeError">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_getGoodifiedArray"></a><span class="summary-sig-name">_getGoodifiedArray</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      return &quot;well behaved&quot; version of a numpy array 1) convert 
      lists or tuple to numpy-array 2) make copy of numpy arrays if 
      non-contigous or non-native 3) convert(relabel) dtype=bool to 
      dtype=uint8 (arr.view(N.uint8)) (used in conjunction with SWIGed 
      functions)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getGoodifiedArray">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="naSetArrayPrintMode"></a><span class="summary-sig-name">naSetArrayPrintMode</span>(<span class="summary-sig-arg">precision</span>=<span class="summary-sig-default">4</span>,
        <span class="summary-sig-arg">suppress_small</span>=<span class="summary-sig-default">1</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#naSetArrayPrintMode">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="debug"></a><span class="summary-sig-name">debug</span>()</span><br />
      calls post-mortem-debugger  pdm.pm()
commands:
    q - quit
    l - list
    p - print 'variable'
    u - up in calling stack
    d - down in calling stack
    h - help
    ...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#debug">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="DEBUG_HERE"></a><span class="summary-sig-name">DEBUG_HERE</span>()</span><br />
      calls debugger  pdm.set_trace() go into debugger mode once execution 
      reaches this line</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#DEBUG_HERE">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#timeIt" class="summary-sig-name">timeIt</a>(<span class="summary-sig-arg">execStr</span>,
        <span class="summary-sig-arg">nReps</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">useTime</span>=<span class="summary-sig-default">False</span>)</span><br />
      calls exec(execStr)  nReps times
returns &quot;cpu-time-after&quot;-&quot;cpu-time-before&quot;
if nReps &gt; 1  the it calls it nReps times
              and return mmms over all (each separately timed!)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#timeIt">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="reload"></a><span class="summary-sig-name">reload</span>(<span class="summary-sig-arg">*modules</span>)</span><br />
      shortcut for non-verbose reloading of modules</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#reload">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#reloadAll" class="summary-sig-name">reloadAll</a>(<span class="summary-sig-arg">verbose</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">repeat</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">hiddenPriithon</span>=<span class="summary-sig-default">True</span>)</span><br />
      reload all modules known in __main__</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#reloadAll">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#localsAsOneObject" class="summary-sig-name">localsAsOneObject</a>(<span class="summary-sig-arg">*args</span>)</span><br />
      useful for rapid code development / debugging:</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#localsAsOneObject">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#strTranslate" class="summary-sig-name">strTranslate</a>(<span class="summary-sig-arg">s</span>,
        <span class="summary-sig-arg">frm</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">to</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">delete</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">keep</span>=<span class="summary-sig-default">None</span>)</span><br />
      translate chars in string `s`
each `c` in `frm` is translated into the respective `c` in `to`
  (`to` can be length 1)
each `c` in `keep` is kept
 UNLESS(!) it is also in `delete`
each `c` in `delete` is taken out</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#strTranslate">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#exe" class="summary-sig-name">exe</a>(<span class="summary-sig-arg">cmd</span>,
        <span class="summary-sig-arg">special_cd</span>=<span class="summary-sig-default">True</span>)</span><br />
      execute cmd in (Unix or Windows) shell
raise OSError on error
return stdout/stderr output lines as list of strings</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#exe">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#email" class="summary-sig-name">email</a>(<span class="summary-sig-arg">message</span>,
        <span class="summary-sig-arg">to</span>,
        <span class="summary-sig-arg">subject</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">email from Priithon</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">From</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">SMTP_USER</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">SMTP_PASSWORD</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">SMTP</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">SMTP_PORT</span>=<span class="summary-sig-default">None</span>)</span><br />
      send an email message via SMTP server to recipient(s)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#email">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#memNAprofile" class="summary-sig-name">memNAprofile</a>(<span class="summary-sig-arg">dicts</span>=<span class="summary-sig-default"><code class="variable-group">[</code><code class="variable-group">]</code></span>,
        <span class="summary-sig-arg">addHere</span>=<span class="summary-sig-default">3</span>,
        <span class="summary-sig-arg">verbose</span>=<span class="summary-sig-default">True</span>)</span><br />
      report on numarray mem usage in given dictinoaries (or modules)
if addHere is
   1 include locals() dict from where memNAprofile is called
   2 include globals() dict from where memNAprofile is called
   3 both</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#memNAprofile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="dirNA"></a><span class="summary-sig-name">dirNA</span>(<span class="summary-sig-arg">inclSize</span>=<span class="summary-sig-default">0</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#dirNA">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#deriv1D" class="summary-sig-name">deriv1D</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">reverse</span>=<span class="summary-sig-default">0</span>)</span><br />
      poor mans derivative:...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#deriv1D">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="checkGoodArrayF"></a><span class="summary-sig-name">checkGoodArrayF</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">argnum</span>,
        <span class="summary-sig-arg">shape</span>=<span class="summary-sig-default">None</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#checkGoodArrayF">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrSharedMemory"></a><span class="summary-sig-name">arrSharedMemory</span>(<span class="summary-sig-arg">shape</span>,
        <span class="summary-sig-arg">dtype</span>,
        <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">PriithonSharedMemory</code><code class="variable-quote">'</code></span>)</span><br />
      Windows only ! share memory between different processes if same `tag`
      is used.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrSharedMemory">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arr"></a><span class="summary-sig-name">arr</span>(<span class="summary-sig-arg">dtype</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array if dtype is None use 
      &quot;default/automatic&quot; dtype</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arr">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrF"></a><span class="summary-sig-name">arrF</span>(<span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array dtype=Float32</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrF">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrD"></a><span class="summary-sig-name">arrD</span>(<span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array dtype=Float64</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrD">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrI"></a><span class="summary-sig-name">arrI</span>(<span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array dtype=Int32</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrI">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrU"></a><span class="summary-sig-name">arrU</span>(<span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array dtype=UInt16</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrU">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrS"></a><span class="summary-sig-name">arrS</span>(<span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array dtype=Int16</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrS">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrC"></a><span class="summary-sig-name">arrC</span>(<span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array dtype=Complex64 (single prec)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrC">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="arrCC"></a><span class="summary-sig-name">arrCC</span>(<span class="summary-sig-arg">*args</span>)</span><br />
      return args tuple as array dtype=Complex128 (double prec)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#arrCC">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="asFloat32"></a><span class="summary-sig-name">asFloat32</span>(<span class="summary-sig-arg">a</span>)</span><br />
      returns N.asarray(a, N.Float32)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#asFloat32">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#asUInt16" class="summary-sig-name">asUInt16</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">round</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">setMinTo0</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">rescaleToMax</span>=<span class="summary-sig-default">False</span>)</span><br />
      returns N.asarray(a, N.uint16)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#asUInt16">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#norm" class="summary-sig-name">norm</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">axis</span>=<span class="summary-sig-default">-1</span>)</span><br />
      return array with ndim arr.ndim-1
        return N.sqrt(N.sum(arr**2, axis)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#norm">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="clip"></a><span class="summary-sig-name">clip</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">min</span>,
        <span class="summary-sig-arg">max</span>)</span><br />
      clips arr *inplace* returns arr</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#clip">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="findMax"></a><span class="summary-sig-name">findMax</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      returns value and position of maximum in arr assumes 3D array, so 
      returned is a 4-tuple: [val,z,y,x] for 2D or 1D z,y would be 
      respectively 0</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#findMax">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="findMin"></a><span class="summary-sig-name">findMin</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      returns value and position of minimum in arr assumes 3D array, so 
      returned is a 4-tuple: [val,z,y,x] for 2D or 1D z,y would be 
      respectively 0</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#findMin">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="min"></a><span class="summary-sig-name">min</span>(<span class="summary-sig-arg">arr</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#min">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="max"></a><span class="summary-sig-name">max</span>(<span class="summary-sig-arg">arr</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#max">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="median"></a><span class="summary-sig-name">median</span>(<span class="summary-sig-arg">arr</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#median">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="median2"></a><span class="summary-sig-name">median2</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      returns both median and &quot;median deviation&quot; (tuple) (broken 
      on windows !!! returns always -999, see 'seb1.cpp')</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#median2">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mean"></a><span class="summary-sig-name">mean</span>(<span class="summary-sig-arg">arr</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mean">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="stddev"></a><span class="summary-sig-name">stddev</span>(<span class="summary-sig-arg">arr</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#stddev">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="FWHM"></a><span class="summary-sig-name">FWHM</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      returns Full-Width-Half-Max for gaussian distributions</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#FWHM">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="FWHM_s"></a><span class="summary-sig-name">FWHM_s</span>(<span class="summary-sig-arg">gaussStddev</span>)</span><br />
      returns Full-Width-Half-Max for gaussian distributions gaussStddev is
      the stddev of arr</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#FWHM_s">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="deg2rad"></a><span class="summary-sig-name">deg2rad</span>(<span class="summary-sig-arg">angle</span>)</span><br />
      return angle(given in degree) converted to randians</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#deg2rad">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="rad2deg"></a><span class="summary-sig-name">rad2deg</span>(<span class="summary-sig-arg">angle</span>)</span><br />
      return angle(given in randians) converted to degree</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#rad2deg">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mm"></a><span class="summary-sig-name">mm</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      returns min,max of arr</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mm">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mmm"></a><span class="summary-sig-name">mmm</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      returns min,max,mean of arr</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mmm">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mmms"></a><span class="summary-sig-name">mmms</span>(<span class="summary-sig-arg">arr</span>)</span><br />
      returns min,max,mean,stddev of arr</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mmms">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mean2d"></a><span class="summary-sig-name">mean2d</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">&lt;type 'numpy.float32'&gt;</span>)</span><br />
      returns an array of shape arr.shape[:-2] and dtype outtype</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mean2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="max2d"></a><span class="summary-sig-name">max2d</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">None</span>)</span><br />
      returns an array of shape arr.shape[:-2] and dtype outtype if 
      outtype=None it uses arr.dtype</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#max2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="min2d"></a><span class="summary-sig-name">min2d</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">None</span>)</span><br />
      returns an array of shape arr.shape[:-2] and dtype outtype if 
      outtype=None it uses arr.dtype</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#min2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mmm2d"></a><span class="summary-sig-name">mmm2d</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">None</span>)</span><br />
      min-max-mean: returns an array of shape (3,)+arr.shape[:-2] and dtype
      outtype if outtype=None it uses arr.dtype</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mmm2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mmms2d"></a><span class="summary-sig-name">mmms2d</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">&lt;type 'numpy.float32'&gt;</span>)</span><br />
      min-max-mean-stddev: returns an array of shape (4,)+arr.shape[:-2] 
      and dtype outtype if outtype=None it uses arr.dtype</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mmms2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="mm2d"></a><span class="summary-sig-name">mm2d</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">None</span>)</span><br />
      min-max: returns an array of shape (2,)+arr.shape[:-2] and dtype 
      outtype if outtype=None it uses arr.dtype</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#mm2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#median2d" class="summary-sig-name">median2d</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">None</span>)</span><br />
      median per 2d section</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#median2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#median22d" class="summary-sig-name">median22d</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">None</span>)</span><br />
      median2 per 2d section [median is (median,meddev)]</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#median22d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#topPercentile2d" class="summary-sig-name">topPercentile2d</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">percentile</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">outtype</span>=<span class="summary-sig-default">None</span>)</span><br />
      find Intens.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#topPercentile2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#fitLine" class="summary-sig-name">fitLine</a>(<span class="summary-sig-arg">yy</span>,
        <span class="summary-sig-arg">xx</span>=<span class="summary-sig-default">None</span>)</span><br />
      returns (a,b, yDeltaSumPerVal) for least-sqare-fit of axx(i) + b = 
      yy(i) yDeltaSumPerVal= sum[(axx+ b - yy)**2] **.5 / numPoints</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fitLine">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#yGaussian" class="summary-sig-name">yGaussian</a>(<span class="summary-sig-arg">parms</span>=<span class="summary-sig-default"><code class="variable-group">(</code>10<code class="variable-op">, </code>100<code class="variable-group">)</code></span>,
        <span class="summary-sig-arg">t</span>=<span class="summary-sig-default">0</span>)</span><br />
      t can be a scalar or a vector returns y value(s) of a 1D-gaussian 
      model</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#yGaussian">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#yDecay" class="summary-sig-name">yDecay</a>(<span class="summary-sig-arg">parms</span>=<span class="summary-sig-default"><code class="variable-group">(</code>1000<code class="variable-op">, </code>10000<code class="variable-op">, </code>10<code class="variable-group">)</code></span>,
        <span class="summary-sig-arg">t</span>=<span class="summary-sig-default">0</span>)</span><br />
      t can be a scalar or a vector
returns y value(s) of a decay model
parms:
    tuple of 1 or 3 or 5 or ..</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#yDecay">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="yPoly"></a><span class="summary-sig-name">yPoly</span>(<span class="summary-sig-arg">parms</span>=<span class="summary-sig-default"><code class="variable-group">(</code>1<code class="variable-op">, </code>1<code class="variable-op">, </code>1<code class="variable-group">)</code></span>,
        <span class="summary-sig-arg">t</span>=<span class="summary-sig-default">0</span>)</span><br />
      t can be a scalar or a vector
returns y value(s) of a polygon model
parms:
  baseline, first-order coeff, 2nd, ...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#yPoly">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#yLine" class="summary-sig-name">yLine</a>(<span class="summary-sig-arg">abTuple</span>=<span class="summary-sig-default"><code class="variable-group">(</code>1<code class="variable-op">, </code>1<code class="variable-group">)</code></span>,
        <span class="summary-sig-arg">t</span>=<span class="summary-sig-default">0</span>)</span><br />
      t can be a scalar or a vector...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#yLine">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#fitAny" class="summary-sig-name">fitAny</a>(<span class="summary-sig-arg">f</span>,
        <span class="summary-sig-arg">parmTuple0</span>,
        <span class="summary-sig-arg">data</span>,
        <span class="summary-sig-arg">fixed_mask</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**leastsq_kwargs</span>)</span><br />
      data should be list of (x,y)  tuples
or (x,y,deltaY) [ weighted fitting: minimize (y(x)-x)/deltaY ]</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fitAny">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#fitAny_leftSided" class="summary-sig-name">fitAny_leftSided</a>(<span class="summary-sig-arg">f</span>,
        <span class="summary-sig-arg">parmTuple0</span>,
        <span class="summary-sig-arg">data</span>,
        <span class="summary-sig-arg">xLeftSidedOfParm</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">fixed_mask</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**leastsq_kwargs</span>)</span><br />
      data should be list of (x,y)  tuples
or (x,y,deltaY) [ weighted fitting: minimize (y(x)-x)/deltaY ]</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fitAny_leftSided">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#fitDecay" class="summary-sig-name">fitDecay</a>(<span class="summary-sig-arg">data</span>,
        <span class="summary-sig-arg">p</span>=<span class="summary-sig-default"><code class="variable-group">(</code>1000<code class="variable-op">, </code>10000<code class="variable-op">, </code>10<code class="variable-group">)</code></span>,
        <span class="summary-sig-arg">fixed_mask</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**leastsq_kwargs</span>)</span><br />
      see yDecay.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fitDecay">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#fitGaussian" class="summary-sig-name">fitGaussian</a>(<span class="summary-sig-arg">data</span>,
        <span class="summary-sig-arg">p</span>=<span class="summary-sig-default"><code class="variable-group">(</code>0<code class="variable-op">, </code>10<code class="variable-op">, </code>100<code class="variable-group">)</code></span>,
        <span class="summary-sig-arg">fixed_mask</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**leastsq_kwargs</span>)</span><br />
      see yGaussian.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fitGaussian">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#fitPoly" class="summary-sig-name">fitPoly</a>(<span class="summary-sig-arg">data</span>,
        <span class="summary-sig-arg">p</span>=<span class="summary-sig-default"><code class="variable-group">(</code>1<code class="variable-op">, </code>1<code class="variable-op">, </code>1<code class="variable-group">)</code></span>,
        <span class="summary-sig-arg">fixed_mask</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**leastsq_kwargs</span>)</span><br />
      see yPoly</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fitPoly">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#nd__center_of_mass" class="summary-sig-name">nd__center_of_mass</a>(<span class="summary-sig-arg">input</span>,
        <span class="summary-sig-arg">labels</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">index</span>=<span class="summary-sig-default">None</span>)</span><br />
      Calculate the center of mass of the values of an array at labels.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#nd__center_of_mass">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#nd__maximum_position" class="summary-sig-name">nd__maximum_position</a>(<span class="summary-sig-arg">input</span>,
        <span class="summary-sig-arg">labels</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">index</span>=<span class="summary-sig-default">None</span>)</span><br />
      Find the positions of the maximums of the values of an array at labels.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#nd__maximum_position">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#nd__minimum_position" class="summary-sig-name">nd__minimum_position</a>(<span class="summary-sig-arg">input</span>,
        <span class="summary-sig-arg">labels</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">index</span>=<span class="summary-sig-default">None</span>)</span><br />
      Find the positions of the minimums of the values of an array at labels.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#nd__minimum_position">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#nd__sum" class="summary-sig-name">nd__sum</a>(<span class="summary-sig-arg">input</span>,
        <span class="summary-sig-arg">labels</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">index</span>=<span class="summary-sig-default">None</span>)</span><br />
      Calculate the sum of the values of the array.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#nd__sum">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="noiseSigma"></a><span class="summary-sig-name">noiseSigma</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">backgroundMean</span>=<span class="summary-sig-default">None</span>)</span><br />
      ask Erik</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#noiseSigma">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="signal2noise"></a><span class="summary-sig-name">signal2noise</span>(<span class="summary-sig-arg">arr</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#signal2noise">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#interpolate1d" class="summary-sig-name">interpolate1d</a>(<span class="summary-sig-arg">x0</span>,
        <span class="summary-sig-arg">y</span>,
        <span class="summary-sig-arg">x</span>=<span class="summary-sig-default">None</span>)</span><br />
      assume a function f(x) = y defined by value-pairs in y,x evaluate 
      this at x=x0</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#interpolate1d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#histogram" class="summary-sig-name">histogram</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">nBins</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amin</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amax</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">histArr</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">norm</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">cumsum</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">returnTuple</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">exclude_amax</span>=<span class="summary-sig-default">False</span>)</span><br />
      creates/returns  array with nBins int32 entries
   fills it with histogram of 'a'
if amin and/or amax is None it calculates the min/max of a and uses that
if nBins is None:
    nBins = int(amax-amin+1)
    if narr is of float dtype and nBins &lt; 100:
        nBins = 100
if histArr is given it is used to fill in the histogram values
    then nBins must be None and histArr of dtype N.int32</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#histogram">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#histogramXY" class="summary-sig-name">histogramXY</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">nBins</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amin</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amax</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">histArr</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">norm</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">cumsum</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">exclude_amax</span>=<span class="summary-sig-default">False</span>)</span><br />
      returns flipped version of histogramYX
use this e.g.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#histogramXY">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#histogramYX" class="summary-sig-name">histogramYX</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">nBins</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amin</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amax</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">histArr</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">norm</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">cumsum</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">exclude_amax</span>=<span class="summary-sig-default">False</span>)</span><br />
      returns same as U.histogram
but also a &quot;range array&quot; amin,...amax with nBins entries</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#histogramYX">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#generalhistogram" class="summary-sig-name">generalhistogram</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">weightImg</span>,
        <span class="summary-sig-arg">nBins</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amin</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amax</span>=<span class="summary-sig-default">None</span>)</span><br />
      creates/returns (&quot;histogram&quot;) array with nBins entries of same dtype as weightImg
while for a standard histogram one adds up 1s in bins for
      each time you encouter a certain value in a
generalhistogram  adds the pixel value found in weightImg 
      each time it encouters a certain value in a (for that pixel)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#generalhistogram">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="radialHistogram"></a><span class="summary-sig-name">radialHistogram</span>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">orig</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">wrap</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">nBins</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">amax</span>=<span class="summary-sig-default">None</span>)</span><br />
      returns 1D histogram of values sorted by euclidian distance from 
      `orig`</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#radialHistogram">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#topPercentile" class="summary-sig-name">topPercentile</a>(<span class="summary-sig-arg">img</span>,
        <span class="summary-sig-arg">percentile</span>=<span class="summary-sig-default">1</span>)</span><br />
      find intensity for highest percentile
e.g.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#topPercentile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="l2norm"></a><span class="summary-sig-name">l2norm</span>(<span class="summary-sig-arg">a</span>)</span><br />
      return the euclidian length of vector a return N.sqrt(a**2).sum())</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#l2norm">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="l1norm"></a><span class="summary-sig-name">l1norm</span>(<span class="summary-sig-arg">a</span>)</span><br />
      return the &quot;abs&quot;-norm of vector a return N.sum(abs(a))</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#l1norm">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#rms" class="summary-sig-name">rms</a>(<span class="summary-sig-arg">a</span>)</span><br />
      returns root mean square (aka.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#rms">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="phase"></a><span class="summary-sig-name">phase</span>(<span class="summary-sig-arg">a</span>)</span><br />
      returns N.arctan2(a.imag, a.real)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#phase">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="polar2cplx"></a><span class="summary-sig-name">polar2cplx</span>(<span class="summary-sig-arg">aAbs</span>,
        <span class="summary-sig-arg">aPhase</span>)</span><br />
      returns new complex array 'a' with a.real = aAbs * N.cos(aPhase) 
      a.imag = aAbs * N.sin(aPhase)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#polar2cplx">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="rot90"></a><span class="summary-sig-name">rot90</span>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">n</span>)</span><br />
      return a.copy() rotated n == 1 --&gt; counter-clockwise n == 2 --&gt;
      180 degrees n == 3 --&gt; clockwise n ==-1 --&gt; clockwise</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#rot90">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#project" class="summary-sig-name">project</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">axis</span>=<span class="summary-sig-default">0</span>)</span><br />
      returns maximum projection along given [old: 'first'(e.g.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#project">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#project_lowmem" class="summary-sig-name">project_lowmem</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">max</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">astype</span>=<span class="summary-sig-default">None</span>)</span><br />
      calc projection along axis 0
`mode`: == &quot;max&quot; -&gt; calc maximum intensity projection
        == &quot;mean&quot; -&gt; calc mean intensity projection
            (accumulation is always done using float64)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#project_lowmem">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#insert" class="summary-sig-name">insert</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">i</span>,
        <span class="summary-sig-arg">entry</span>,
        <span class="summary-sig-arg">axis</span>=<span class="summary-sig-default">0</span>)</span><br />
      returns new array with new element inserted at index i along axis if 
      arr.ndim&gt;1 and if entry is scalar it gets filled in (ref.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#insert">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#trans2d" class="summary-sig-name">trans2d</a>(<span class="summary-sig-arg">inArr</span>,
        <span class="summary-sig-arg">outArr</span>,
        <span class="summary-sig-arg">(tx, ty, rot, mag, gmag2_axis, gmag2)</span>)</span><br />
      first translates by tx,ty
THEN rotate and mag and aniso-mag
    (rotation relative to img-center !
     positive angle moves object counter-clockwise)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#trans2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#translate2d" class="summary-sig-name">translate2d</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">b</span>,
        <span class="summary-sig-arg">tx</span>,
        <span class="summary-sig-arg">ty</span>)</span><br />
      shift a in to b</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#translate2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#transmat2d" class="summary-sig-name">transmat2d</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">b</span>,
        <span class="summary-sig-arg">tx</span>,
        <span class="summary-sig-arg">ty</span>,
        <span class="summary-sig-arg">m11</span>,
        <span class="summary-sig-arg">m12</span>,
        <span class="summary-sig-arg">m21</span>,
        <span class="summary-sig-arg">m22</span>,
        <span class="summary-sig-arg">tx2</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">ty2</span>=<span class="summary-sig-default">0</span>)</span><br />
      transform a(input) into b(output) :
first translates by tx,ty
THEN apply rotate/skew
    (rotation relative to img-center !
     positive angle moves object counter-clockwise)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#transmat2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="rot3d"></a><span class="summary-sig-name">rot3d</span>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">b</span>,
        <span class="summary-sig-arg">angle</span>,
        <span class="summary-sig-arg">rot_axis</span>=<span class="summary-sig-default">0</span>)</span><br />
      a: 3d input array b: 3d output array angle: in degree, rot_axis: axis
      to rotate the object about</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#rot3d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_getImgMode"></a><span class="summary-sig-name">_getImgMode</span>(<span class="summary-sig-arg">im</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getImgMode">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#image2array" class="summary-sig-name">image2array</a>(<span class="summary-sig-arg">im</span>,
        <span class="summary-sig-arg">i0</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">iDelta</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">squeezeGreyRGB</span>=<span class="summary-sig-default">True</span>)</span><br />
      Convert image to numpy array</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#image2array">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#array2image" class="summary-sig-name">array2image</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">rgbOrder</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>)</span><br />
      Convert numpy array to image...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#array2image">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#load" class="summary-sig-name">load</a>(<span class="summary-sig-arg">fn</span>)</span><br />
      open any image file:
   '.fits'  - FITS files
   '.sif'   - Andor SIF files
   '.his'   - Hamamatsu HIS files
   '.spe'   - Princeton Instruments CCD image format (SPE) files
   '.lsm'   - Zeiss LSM images are read like TIFF; skipping every other slice (thumbnail)
   any image file: jpg/bmp/png/...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#load">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#loadImg" class="summary-sig-name">loadImg</a>(<span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">i0</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">iDelta</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">squeezeGreyRGB</span>=<span class="summary-sig-default">True</span>)</span><br />
      Loads image file (tiff,jpg,...) and return it as array</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadImg">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="loadImg_iterSec"></a><span class="summary-sig-name">loadImg_iterSec</span>(<span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">i0</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">iDelta</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">squeezeGreyRGB</span>=<span class="summary-sig-default">True</span>)</span><br />
      iterator: Loads image file (tiff,jpg,...) and iterate section-wise 
      yielding a 2d array</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadImg_iterSec">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#loadImg_seq" class="summary-sig-name">loadImg_seq</a>(<span class="summary-sig-arg">fns</span>,
        <span class="summary-sig-arg">channels</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">verbose</span>=<span class="summary-sig-default">0</span>)</span><br />
      Open multiple TIFF-files into a 3-(or 4-)D numpy stack.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadImg_seq">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#saveImg" class="summary-sig-name">saveImg</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">forceMultipage</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">rgbOrder</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">format</span>=<span class="summary-sig-default">None</span>)</span><br />
      Saves data array as image file (format from    extension !! .tif,.jpg,...)
tries to use number format of 'arr'
also supports multipage TIFF:
    3D arrays: grey (if more than 4 z-secs or `forceMultipage`==True)
    4D arrays: color (second dim must be of len 2..4 (RG[B[A]])&quot;</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_saveSeq_getFixedFN"></a><span class="summary-sig-name">_saveSeq_getFixedFN</span>(<span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">n</span>)</span><br />
      check that fn contains a '%02d'-like part' autofix if necessary (add 
      enough digits to fit n filenames)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_saveSeq_getFixedFN">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#saveImg_seq" class="summary-sig-name">saveImg_seq</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">rgbOrder</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>)</span><br />
      Saves 3D data array as 8-bit gray image file sequence (format from  extension !! .tif,.jpg,...)
filename should contain a &quot;template&quot; like %02d - use '%%' otherwise inplace of single '%'
template gets replaced with 00,01,02,03,...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg_seq">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#saveImg8" class="summary-sig-name">saveImg8</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">forceMultipage</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">rgbOrder</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">format</span>=<span class="summary-sig-default">None</span>)</span><br />
      Saves data array as 8-bit gray image file (format from  extension !! .tif,.jpg,...)
be careful about up-down orientation !!
if arr.dtype is not N.uint8  arr gets rescaled to 0..255
also supports multipage TIFF:
    arr gets rescaled to 0..255 to match min..max of entire stack
    3D arrays: grey (if more than 4 z-secs or forceMultipage==True)
    4D arrays: color (second dim must be of len 2..4 (RG[B[A]])&quot;</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg8">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#saveImg8_seq" class="summary-sig-name">saveImg8_seq</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">rgbOrder</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>)</span><br />
      Saves 3D data array as 8-bit gray image file sequence (format from  extension !! .tif,.jpg,...)
filename must contain a &quot;template&quot; like %02d - use '%%' otherwise inplace of single '%'
template gets replaced with 00,01,02,03,...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg8_seq">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="loadFits"></a><span class="summary-sig-name">loadFits</span>(<span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">slot</span>=<span class="summary-sig-default">0</span>)</span><br />
      Loads FITC file and return it as array</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadFits">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#loadHIS" class="summary-sig-name">loadHIS</a>(<span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">secStart</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">secEnd</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">stride</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>)</span><br />
      load Hamamatsu Image Sequence file format</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadHIS">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="loadSPE"></a><span class="summary-sig-name">loadSPE</span>(<span class="summary-sig-arg">fn</span>)</span><br />
      load Princeton Instruments CCD image format (.SPE)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadSPE">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="saveFits"></a><span class="summary-sig-name">saveFits</span>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">overwrite</span>=<span class="summary-sig-default">True</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveFits">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#saveTiffMultipage" class="summary-sig-name">saveTiffMultipage</a>(<span class="summary-sig-arg">arr</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">rescaleTo8bit</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">rgbOrder</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">**params</span>)</span><br />
      extension to PIL save TIFF
if rescaleTo8bit: scale sections (using global(!) min &amp; max intesity) to 0..255
    (ratios between colors are unchanged)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveTiffMultipage">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#saveTiffMultipageFromSeq" class="summary-sig-name">saveTiffMultipageFromSeq</a>(<span class="summary-sig-arg">arrseq</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">rescaleSeqTo8bit</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">rgbOrder</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">**params</span>)</span><br />
      arrseq can be an iterator that yield 2D(grey) or 3D(color) image</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveTiffMultipageFromSeq">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="loadImageFromURL"></a><span class="summary-sig-name">loadImageFromURL</span>(<span class="summary-sig-arg">url</span>)</span><br />
      download url of an image file into local cache and return numpy array</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadImageFromURL">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#calc_threshold_basic" class="summary-sig-name">calc_threshold_basic</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">histYX</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">dt</span>=<span class="summary-sig-default">0.5</span>,
        <span class="summary-sig-arg">nMax</span>=<span class="summary-sig-default">100</span>,
        <span class="summary-sig-arg">retImg</span>=<span class="summary-sig-default">False</span>)</span><br />
      calculate a threshold value
using the &quot;Basic Global Thresholding&quot; method
described in Ch.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_basic">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#calc_threshold_otsu" class="summary-sig-name">calc_threshold_otsu</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">histYX</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">retEM</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">retImg</span>=<span class="summary-sig-default">False</span>)</span><br />
      calculate a threshold value
using &quot;Otsu's Method&quot;
described in Ch.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_otsu">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#calc_threshold_otsu2" class="summary-sig-name">calc_threshold_otsu2</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">histYX</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">retEM</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">retImg</span>=<span class="summary-sig-default">False</span>)</span><br />
      calculate multiple (i.e.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_otsu2">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#calc_threshold_otsu3" class="summary-sig-name">calc_threshold_otsu3</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">histYX</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">retEM</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">retImg</span>=<span class="summary-sig-default">False</span>)</span><br />
      calculate 3 threshold values using &quot;Otsu's Method&quot;
described in Ch.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_otsu3">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_getconv"></a><span class="summary-sig-name">_getconv</span>(<span class="summary-sig-arg">dtype</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_getconv">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_string_like"></a><span class="summary-sig-name">_string_like</span>(<span class="summary-sig-arg">obj</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#_string_like">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#saveTxt" class="summary-sig-name">saveTxt</a>(<span class="summary-sig-arg">arrND</span>,
        <span class="summary-sig-arg">fname</span>,
        <span class="summary-sig-arg">fmt</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">%8.3f</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">delimiter</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"> </code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">intro</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">transpose</span>=<span class="summary-sig-default">False</span>)</span><br />
      write 2D arrays as rows(-2 axis) of columns (last axis)
for each additional dimension, prepend a column for the axis index 
  (total of arrNDndim-2 additional columns)
1D arrays are written as one value per line</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#saveTxt">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#loadTxt" class="summary-sig-name">loadTxt</a>(<span class="summary-sig-arg">fname</span>,
        <span class="summary-sig-arg">ndim</span>=<span class="summary-sig-default">3</span>,
        <span class="summary-sig-arg">dtype</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">delimiter</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">skipNlines</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">comments</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">converters</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">usecols</span>=<span class="summary-sig-default">None</span>)</span><br />
      load a text file into a ndimensional array (mockNDarray)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#loadTxt">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#text2array" class="summary-sig-name">text2array</a>(<span class="summary-sig-arg">txt</span>,
        <span class="summary-sig-arg">transpose</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">comment</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">sep</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">convFcn</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">skipNlines</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">convertDecimalKomma</span>=<span class="summary-sig-default">False</span>)</span><br />
      Return an array containing the data contained as text in txt.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#text2array">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="uu_encodestring"></a><span class="summary-sig-name">uu_encodestring</span>(<span class="summary-sig-arg">text</span>,
        <span class="summary-sig-arg">compress</span>=<span class="summary-sig-default">True</span>)</span><br />
      from http://effbot.org/librarybook/uu.htm seb added bz2 compression</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#uu_encodestring">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="uu_decodestring"></a><span class="summary-sig-name">uu_decodestring</span>(<span class="summary-sig-arg">text</span>,
        <span class="summary-sig-arg">decompress</span>=<span class="summary-sig-default">True</span>)</span><br />
      from http://effbot.org/librarybook/uu.htm seb added bz2 compression</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#uu_decodestring">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#grep" class="summary-sig-name">grep</a>(<span class="summary-sig-arg">pattern</span>,
        <span class="summary-sig-arg">*files</span>)</span><br />
      emulate grep-functionality</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#grep">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="pathPrependToFilename"></a><span class="summary-sig-name">pathPrependToFilename</span>(<span class="summary-sig-arg">path</span>,
        <span class="summary-sig-arg">prefix</span>)</span><br />
      given filename path containing multiple parent folders change only 
      the last &quot;file name&quot; part by prepending `prefix`; keep all 
      parent folder names unchanced</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#pathPrependToFilename">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#path_mkdir" class="summary-sig-name">path_mkdir</a>(<span class="summary-sig-arg">newdir</span>)</span><br />
      works the way a good mkdir should :)
- already exists, silently complete
- regular file in the way, raise an exception
- parent directory(ies) does not exist, make them as well</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#path_mkdir">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="sgn"></a><span class="summary-sig-name">sgn</span>(<span class="summary-sig-arg">a</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#sgn">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#binaryRepr" class="summary-sig-name">binaryRepr</a>(<span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">count</span>=<span class="summary-sig-default">8</span>)</span><br />
      Integer to &quot;binary string&quot; (&quot;101011&quot;) returns 
      string of length count containing '0's and '1' building up the 
      &quot;binary representation&quot; of x Count is number of bits</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#binaryRepr">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#deco_simple_decorator" class="summary-sig-name">deco_simple_decorator</a>(<span class="summary-sig-arg">decorator</span>)</span><br />
      This decorator can be used to turn simple functions into well-behaved
      decorators, so long as the decorators are fairly simple.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#deco_simple_decorator">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#deco_addInstanceMethodTo" class="summary-sig-name">deco_addInstanceMethodTo</a>(<span class="summary-sig-arg">instance</span>)</span><br />
      Easy adding methods to a class instance</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#deco_addInstanceMethodTo">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="fib"></a><span class="summary-sig-name">fib</span>(<span class="summary-sig-arg">max</span>=<span class="summary-sig-default">100</span>,
        <span class="summary-sig-arg">startWith0</span>=<span class="summary-sig-default">True</span>)</span><br />
      uses generator to iterate over sequence of Fibonacci numbers</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fib">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#fib2" class="summary-sig-name">fib2</a>(<span class="summary-sig-arg">n</span>)</span><br />
      direct calc (non-recursive) return n_th Fibonacci number (as float!) 
      n=0 --&gt; 0 n=1 --&gt; 1 n=2 --&gt; 1 ...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#fib2">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="primes"></a><span class="summary-sig-name">primes</span>(<span class="summary-sig-arg">max</span>=<span class="summary-sig-default">100</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#primes">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#primeFactors" class="summary-sig-name">primeFactors</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">max</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">includeRemainder</span>=<span class="summary-sig-default">False</span>)</span><br />
      return list of a's prime factors...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#primeFactors">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="factorial"></a><span class="summary-sig-name">factorial</span>(<span class="summary-sig-arg">n</span>,
        <span class="summary-sig-arg">_memo</span>=<span class="summary-sig-default"><code class="variable-group">{</code>0<code class="variable-op">: </code>1<code class="variable-op">, </code>1<code class="variable-op">: </code>1<code class="variable-group">}</code></span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#factorial">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="fac"></a><span class="summary-sig-name">fac</span>(<span class="summary-sig-arg">n</span>,
        <span class="summary-sig-arg">_memo</span>=<span class="summary-sig-default"><code class="variable-group">{</code>0<code class="variable-op">: </code>1<code class="variable-op">, </code>1<code class="variable-op">: </code>1<code class="variable-group">}</code></span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#factorial">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#gamma" class="summary-sig-name">gamma</a>(<span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">_memo</span>=<span class="summary-sig-default"><code class="variable-group">{</code>0.5<code class="variable-op">: </code>1.77245385091<code class="variable-op">, </code>1.0<code class="variable-op">: </code>1.0<code class="variable-group">}</code></span>)</span><br />
      return gamma function defined for integer and half-integer values</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#gamma">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="iterIndices"></a><span class="summary-sig-name">iterIndices</span>(<span class="summary-sig-arg">shape</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#iterIndices">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="iterPermutations"></a><span class="summary-sig-name">iterPermutations</span>(<span class="summary-sig-arg">iterable</span>,
        <span class="summary-sig-arg">r</span>=<span class="summary-sig-default">None</span>)</span><br />
      # permutations('ABCD', 2) --&gt; AB AC AD BA BC BD CA CB CD DA DB DC 
      # permutations(range(3)) --&gt; 012 021 102 120 201 210 in Python 2.6
      this is itertools.permutations</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#iterPermutations">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="iterProduct"></a><span class="summary-sig-name">iterProduct</span>(<span class="summary-sig-arg">*args</span>,
        <span class="summary-sig-arg">**kwds</span>)</span><br />
      iterProduct(*iterables[, repeat])  ## note: keyword-only argument ! #
      product('ABCD', 'xy') --&gt; Ax Ay Bx By Cx Cy Dx Dy # 
      product(range(2), repeat=3) --&gt; 000 001 010 011 100 101 110 111 in
      Python 2.6 this is itertools.product</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#iterProduct">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#smooth1d" class="summary-sig-name">smooth1d</a>(<span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">window_len</span>=<span class="summary-sig-default">10</span>,
        <span class="summary-sig-arg">window</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">hanning</code><code class="variable-quote">'</code></span>)</span><br />
      smooth the data using a window with requested size.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#smooth1d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#unique" class="summary-sig-name">unique</a>(<span class="summary-sig-arg">s</span>)</span><br />
      Return a list of the elements in s, but without duplicates.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#unique">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">list</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#flatten" class="summary-sig-name">flatten</a>(<span class="summary-sig-arg">sequence</span>)</span><br />
      Returns a single, flat list which contains all elements retrieved
from the sequence and all recursively contained sub-sequences
(iterables).</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#flatten">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#hexdump" class="summary-sig-name">hexdump</a>(<span class="summary-sig-arg">s</span>,
        <span class="summary-sig-arg">numsPerLine</span>=<span class="summary-sig-default">16</span>,
        <span class="summary-sig-arg">ret</span>=<span class="summary-sig-default">False</span>)</span><br />
      dump any kind of string, ascii, encoded, or unicode, using the 
      standard hex dump output format.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#hexdump">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#zip_extractall" class="summary-sig-name">zip_extractall</a>(<span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">outDir</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">percent</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">verbose</span>=<span class="summary-sig-default">False</span>)</span><br />
      extract zip file into a directory (default to current working dir)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#zip_extractall">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.useful-module.html#zip_zipDir" class="summary-sig-name">zip_zipDir</a>(<span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">dir</span>)</span><br />
      create new zip archive with filename `fn` and put everything inside 
      directory `dir` into it</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#zip_zipDir">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="hasDuplicates"></a><span class="summary-sig-name">hasDuplicates</span>(<span class="summary-sig-arg">s</span>)</span><br />
      returns True or False depending on `s` having duplicate entries Items
      in `s` have to be hashable.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#hasDuplicates">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="normAngle"></a><span class="summary-sig-name">normAngle</span>(<span class="summary-sig-arg">angle</span>,
        <span class="summary-sig-arg">abs</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">useDegree</span>=<span class="summary-sig-default">True</span>)</span><br />
      return equivalent of `angle` in -180&lt;=..&lt;180 range if `abs` is 
      True return absolute of that</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#normAngle">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="diffAngle"></a><span class="summary-sig-name">diffAngle</span>(<span class="summary-sig-arg">a1</span>,
        <span class="summary-sig-arg">a0</span>,
        <span class="summary-sig-arg">abs</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">useDegree</span>=<span class="summary-sig-default">True</span>)</span><br />
      returns a1-a0 handle wrap-around for -180 and +180 returned angle 
      lies in -180&lt;=..&lt;180 range if `abs` is True return absolute of 
      that</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.useful-pysrc.html#diffAngle">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="_FWHM_over_gaussStddev"></a><span class="summary-name">_FWHM_over_gaussStddev</span> = <code title="2.3548200450309493">2.3548200450309493</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="_pi_over_180"></a><span class="summary-name">_pi_over_180</span> = <code title="0.0174532925199">0.0174532925199</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Priithon.useful-module.html#_U_nd_extra_doc_" class="summary-name">_U_nd_extra_doc_</a> = <code title="'''
Seb: this is from scipy.ndimage, but returns ndarray and
fixes return value type &amp; shape
for the cases  len(index) == 1 and len(index) == 0
'''"><code class="variable-quote">'</code><code class="variable-string">\nSeb: this is from scipy.ndimage, but ret</code><code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="_execPriithonRunCommands"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_execPriithonRunCommands</span>()</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#_execPriithonRunCommands">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

http://en.wikipedia.org/wiki/Run_Commands
Rc stands for the phrase &quot;run commands&quot;
It is used for any file that contains startup information for a command.
While not historically precise, rc may also be pronounced as &quot;run control&quot;, because an rc file controls how a program runs.

Similarely to matplotlib (ref. matplotlib_fname()), we look for a &quot;user customization&quot; file,
&quot;.priithonrc.py&quot; in the following order:
1. currentworking directory
2. environment variable PRIITHONRC
3. HOME/.priithonrc.py
4. windows only:  TODO FIXME

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="getHomeDir"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">getHomeDir</span>(<span class="sig-arg">defaultToCwd</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#getHomeDir">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Try to find user's home directory, otherwise return current directory.
  If defaultToCwd is False, returns &quot;&quot; in case nothing else 
  works</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_getSourceCodeLine"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_getSourceCodeLine</span>(<span class="sig-arg">depth</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeLine">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>return &quot;current&quot; line number of source code  inside 
  py-file</p>
  <p>(to be used only inside py-modules - not for interactive shell!)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_getSourceCodeFilename"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_getSourceCodeFilename</span>(<span class="sig-arg">numPathTails</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">depth</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeFilename">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

return &quot;current&quot; filename of py-file 
if numPathTails:
    split off all leading folder before the last numPathTails parts,
    and return only those remaining parts;
    e.g. for numPathTails=2: for &quot;/a/b/c/d/e.py&quot; return &quot;d/e.py&quot;

(to be used only inside py-modules - not for interactive shell!)

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_getSourceCodeFuncName"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_getSourceCodeFuncName</span>(<span class="sig-arg">depth</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeFuncName">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>return &quot;current&quot; function name</p>
  <p>(to be used only inside py-modules - not for interactive shell!)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_getSourceCodeLocation"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_getSourceCodeLocation</span>(<span class="sig-arg">numPathTails</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">depth</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#_getSourceCodeLocation">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>return &lt;filename&gt;:&lt;lineNo concatenating the results of 
  _getSourceCodeFilename  and _getSourceCodeLine</p>
  <p>(to be used only inside py-modules - not for interactive shell!)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="timeIt"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">timeIt</span>(<span class="sig-arg">execStr</span>,
        <span class="sig-arg">nReps</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">useTime</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#timeIt">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

calls exec(execStr)  nReps times
returns &quot;cpu-time-after&quot;-&quot;cpu-time-before&quot;
if nReps &gt; 1  the it calls it nReps times
              and return mmms over all (each separately timed!)

if useTime is False: use time.clock() as timer
if useTime is a callable: use this as time
otherwise: use time.time()
NOTE: on Unix time.clock() gives CPU time, time.time() wall time
      on Windows both are wall time (time.time() ONLY at 1ms resolution)
      http://stackoverflow.com/questions/85451/python-time-clock-vs-time-time-accuracy

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="reloadAll"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">reloadAll</span>(<span class="sig-arg">verbose</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">repeat</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">hiddenPriithon</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#reloadAll">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

reload all modules known in __main__

repeat 'repeat' times - in case of dependencies

if hiddenPriithon is True:
also reload
   viewerCommon.py
   viewer.py
   viewer2.py
   histogram.py
   splitNDCommon.py
   splitND.py
   splitND2.py
   mockNDarray.py

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="localsAsOneObject"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">localsAsOneObject</span>(<span class="sig-arg">*args</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#localsAsOneObject">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>useful for rapid code development / debugging:</p>
  <p>create and return a classObject containing some/all local variables 
  taken from the calling function-frame</p>
  <p>if no args given: return all local vars</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="strTranslate"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">strTranslate</span>(<span class="sig-arg">s</span>,
        <span class="sig-arg">frm</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">to</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">delete</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">keep</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#strTranslate">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

translate chars in string `s`
each `c` in `frm` is translated into the respective `c` in `to`
  (`to` can be length 1)
each `c` in `keep` is kept
 UNLESS(!) it is also in `delete`
each `c` in `delete` is taken out

seb: instead of a class we have a function - ref. ASPN/Cookbook/Python/Recipe/303342

This class handles the three most common cases where I find myself having to stop and think about how to use translate:

1) Keeping only a given set of characters.
&gt;&gt;&gt; strTranslate('Chris Perkins : 224-7992', keep=U.string.digits)
'2247992'

2) Deleting a given set of characters.
&gt;&gt;&gt; strTranslate('Chris Perkins : 224-7992', delete=U.string.digits)
'Chris Perkins : -'

3) Replacing a set of characters with a single character.
&gt;&gt;&gt; trans = Translator(string.digits, '%')
&gt;&gt;&gt; strTranslate('Chris Perkins : 224-7992', (string.digits, '%')
'Chris Perkins : %%%-%%%%'

Note that the delete parameter trumps the keep parameter if they overlap:
&gt;&gt;&gt; strTranslate('abcdef', delete='abcd', keep='cdef')
'ef'
This is an arbitrary design choice - makes as much sense as anything, I suppose.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="exe"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">exe</span>(<span class="sig-arg">cmd</span>,
        <span class="sig-arg">special_cd</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#exe">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

execute cmd in (Unix or Windows) shell
raise OSError on error
return stdout/stderr output lines as list of strings

if `special_cd` is True:
    if `cmd` starts with &quot;cd &quot;
      `os.chcwd` is called, i.e. to 
      *really* change the current working directory
      (not just is (later disappearing)  sub-process)
    if `cmd` == &quot;cd&quot; (no further arguments)
      os.chdir(U.getHomeDir()) is called

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="email"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">email</span>(<span class="sig-arg">message</span>,
        <span class="sig-arg">to</span>,
        <span class="sig-arg">subject</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">email from Priithon</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">From</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">SMTP_USER</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">SMTP_PASSWORD</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">SMTP</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">SMTP_PORT</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#email">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

send an email message via SMTP server to recipient(s)

`to` can be a string or a list of strings

if `From` and `SMPT` are not given, values from 
  PriConfig.email_From
and
  PriConfig.email_SMTP, email_SMTP_PORT, email_SMTP_USER, email_SMTP_PASSWORD
are used

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="memNAprofile"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">memNAprofile</span>(<span class="sig-arg">dicts</span>=<span class="sig-default"><code class="variable-group">[</code><code class="variable-group">]</code></span>,
        <span class="sig-arg">addHere</span>=<span class="sig-default">3</span>,
        <span class="sig-arg">verbose</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#memNAprofile">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

report on numarray mem usage in given dictinoaries (or modules)
if addHere is
   1 include locals() dict from where memNAprofile is called
   2 include globals() dict from where memNAprofile is called
   3 both

if verbose: print stats for each numarray found

returns tuple( number of numarrays, total MB mem usage, timeString)

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="deriv1D"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">deriv1D</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">reverse</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#deriv1D">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
poor mans derivative:
if reverse:
    returns arr[:-1] - arr[1:]
else
    returns arr[1:] - arr[:-1]

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="asUInt16"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">asUInt16</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">round</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">setMinTo0</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">rescaleToMax</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#asUInt16">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
returns N.asarray(a, N.uint16)

`setMinTo0`: if True, subtract (negative) minimum
`rescaleToMax`: if True or 1 rescale data to min..65535
     if `rescaleToMax` is a number &gt; 1: rescale data to min..`rescaleToMax`

`round`: add +.5 before conversion to int

TODO/FIXME:  optimize memory usage of this function !!

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="norm"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">norm</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">axis</span>=<span class="sig-default">-1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#norm">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
return array with ndim arr.ndim-1
        return N.sqrt(N.sum(arr**2, axis)

U.norm([3,4])
5.0
U.timeIt(&quot;U.norm([3,4])&quot;, 100000)
(0.0, 0.02, 0.000384, 0.00192211966329)
U.timeIt(&quot;U.norm([3])&quot;, 100000)
(0.0, 0.02, 0.0003597, 0.00186269050301)
a = na.asarray([3,4])
U.timeIt(&quot;U.norm(a)&quot;, 100000)
(0.0, 0.01, 0.0001728, 0.00130312706978)
a = na.asarray([3])
U.timeIt(&quot;U.norm(a)&quot;, 100000)
(0.0, 0.01, 0.0001689, 0.00128859333771)
U.timeIt(&quot;na.abs(a)&quot;, 100000)
(0.0, 0.02, 0.0001107, 0.00104725618165)
U.timeIt(&quot;abs(a)&quot;, 100000)
(0.0, 0.01, 0.0001092, 0.00103926674151)
    

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="median2d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">median2d</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">outtype</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#median2d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>median per 2d section</p>
  <p>returns an array of shape arr.shape[:-2] and dtype outtype if 
  outtype=None it uses arr.dtype</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="median22d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">median22d</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">outtype</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#median22d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>median2 per 2d section [median is (median,meddev)]</p>
  <p>returns an array of shape (2,)+arr.shape[:-2] and dtype outtype if 
  outtype=None it uses arr.dtype</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="topPercentile2d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">topPercentile2d</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">percentile</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">outtype</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#topPercentile2d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>find Intens. for highest percentile  per section</p>
  <p>returns an array of shape (2,)+arr.shape[:-2] and dtype outtype if 
  outtype=None it uses arr.dtype</p>
  <p>slow!! ****** might only work for UInt16 arr *********</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fitLine"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fitLine</span>(<span class="sig-arg">yy</span>,
        <span class="sig-arg">xx</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#fitLine">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>returns (a,b, yDeltaSumPerVal) for least-sqare-fit of axx(i) + b = 
  yy(i) yDeltaSumPerVal= sum[(axx+ b - yy)**2] **.5 / numPoints</p>
  <p>if xx is None it defaults to 0,1,2,3,4,...</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="yGaussian"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">yGaussian</span>(<span class="sig-arg">parms</span>=<span class="sig-default"><code class="variable-group">(</code>10<code class="variable-op">, </code>100<code class="variable-group">)</code></span>,
        <span class="sig-arg">t</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#yGaussian">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>t can be a scalar or a vector returns y value(s) of a 1D-gaussian 
  model</p>
  <p>parms can be tuple of length 2,3 or 4, with 2: tuple is [sigma, 
  peakVal] 3: tuple is [x0, sigma, peakVal] 4: tuple is [y0, x0, sigma, 
  peakVal]</p>
  <p>x0 is center of gaussian (default 0) y0 is baseline offset gaussian 
  (default 0) sigma is sigma (stddev) of gaussian peakval is  &quot;center 
  height&quot; above baseline</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="yDecay"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">yDecay</span>(<span class="sig-arg">parms</span>=<span class="sig-default"><code class="variable-group">(</code>1000<code class="variable-op">, </code>10000<code class="variable-op">, </code>10<code class="variable-group">)</code></span>,
        <span class="sig-arg">t</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#yDecay">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

t can be a scalar or a vector
returns y value(s) of a decay model
parms:
    tuple of 1 or 3 or 5 or .. values
    first baseline = asymtote =y for t-&gt; inf
    then pairs:
      first:  intercept of an exponential decay
      second: half-time of an exponential decay

    for more than 3 parameters: sum multiple such decay terms

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="yLine"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">yLine</span>(<span class="sig-arg">abTuple</span>=<span class="sig-default"><code class="variable-group">(</code>1<code class="variable-op">, </code>1<code class="variable-group">)</code></span>,
        <span class="sig-arg">t</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#yLine">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

t can be a scalar or a vector
returns y value(s) of a line model
parms:
  abTuple: a,b  - as in y= ax + b

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fitAny"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fitAny</span>(<span class="sig-arg">f</span>,
        <span class="sig-arg">parmTuple0</span>,
        <span class="sig-arg">data</span>,
        <span class="sig-arg">fixed_mask</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**leastsq_kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#fitAny">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

data should be list of (x,y)  tuples
or (x,y,deltaY) [ weighted fitting: minimize (y(x)-x)/deltaY ]

(instead of 'list' you can of course have an array w/
shape=(n,2) or shape=(n,3), n beeing the number of data points

if data.ndim == 1 or data.shape = (n,1) it fits assuming x=0,1,2,3,...n-1

f is your 'model' function that takes two arguments:
   a tuple of parameters and x

The function returns a list containing the optimal parameter values
and the chi-squared value describing the quality of the fit. (CHECK if this is true)

fixed_mask: if not None: 
   this sequence of bool values determinces if the respective parameter
   shall be fixed or free to be adjusted

leastsq_kwargs: optional arguments feed to scipy.optimize.leastsq:
   useful might be e.g.: 
    * maxfev -- The maximum number of calls to the function. If zero,
       then 100*(N+1) is the maximum where N is the number
       of elements in x0.
    * full_output -- non-zero to return all optional outputs.
    * warning -- True to print a warning message when the call is
         unsuccessful; False to suppress the warning message.
    for more see scipy.optimize.leastsq

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fitAny_leftSided"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fitAny_leftSided</span>(<span class="sig-arg">f</span>,
        <span class="sig-arg">parmTuple0</span>,
        <span class="sig-arg">data</span>,
        <span class="sig-arg">xLeftSidedOfParm</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">fixed_mask</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**leastsq_kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#fitAny_leftSided">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

data should be list of (x,y)  tuples
or (x,y,deltaY) [ weighted fitting: minimize (y(x)-x)/deltaY ]

(instead of 'list' you can of course have an array w/
shape=(n,2) or shape=(n,3), n beeing the number of data points

if data.ndim == 1 or data.shape = (n,1) it fits assuming x=0,1,2,3,...n-1

f is your 'model' function that takes two arguments:
   a tuple of parameters and x

!!! MODEL IS ONLY OPTIMIZED FOR X&lt;`parmTuple0[xLeftSidedOfParm]` !!!

The function returns a list containing the optimal parameter values
and the chi-squared value describing the quality of the fit. (CHECK if this is true)

fixed_mask: if not None: 
   this sequence of bool values determinces if the respective parameter
   shall be fixed or free to be adjusted

leastsq_kwargs: optional arguments feed to scipy.optimize.leastsq:
   useful might be e.g.: 
    * maxfev -- The maximum number of calls to the function. If zero,
       then 100*(N+1) is the maximum where N is the number
       of elements in x0.
    * full_output -- non-zero to return all optional outputs.
    * warning -- True to print a warning message when the call is
         unsuccessful; False to suppress the warning message.
    for more see scipy.optimize.leastsq

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fitDecay"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fitDecay</span>(<span class="sig-arg">data</span>,
        <span class="sig-arg">p</span>=<span class="sig-default"><code class="variable-group">(</code>1000<code class="variable-op">, </code>10000<code class="variable-op">, </code>10<code class="variable-group">)</code></span>,
        <span class="sig-arg">fixed_mask</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**leastsq_kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#fitDecay">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

see yDecay.
p: initial guess
data: vector of data points to be fit

if fixed_mask is not None: 
   this sequence of bool values determinces if the respective parameter
   shall be fixed or free to be adjusted

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fitGaussian"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fitGaussian</span>(<span class="sig-arg">data</span>,
        <span class="sig-arg">p</span>=<span class="sig-default"><code class="variable-group">(</code>0<code class="variable-op">, </code>10<code class="variable-op">, </code>100<code class="variable-group">)</code></span>,
        <span class="sig-arg">fixed_mask</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**leastsq_kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#fitGaussian">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

see yGaussian.
p: initial guess
data: vector of data points to be fit

if fixed_mask is not None: 
   this sequence of bool values determinces if the respective parameter
   shall be fixed or free to be adjusted

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fitPoly"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fitPoly</span>(<span class="sig-arg">data</span>,
        <span class="sig-arg">p</span>=<span class="sig-default"><code class="variable-group">(</code>1<code class="variable-op">, </code>1<code class="variable-op">, </code>1<code class="variable-group">)</code></span>,
        <span class="sig-arg">fixed_mask</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**leastsq_kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#fitPoly">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

see yPoly

data should be list of y or (x,y)- or (x,y,deltaY)-tuples
(instead of 'list' you can of course have an array w/
shape=(n,2) or shape=(n,3), n beeing the number of data points

uses polynomial 'model' ( U.yPoly )

The function returns a list containing the optimal parameter values
and the chi-squared value describing the quality of the fit.

if fixed_mask is not None: 
   this sequence of bool values determinces if the respective parameter
   shall be fixed or free to be adjusted

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="nd__center_of_mass"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">nd__center_of_mass</span>(<span class="sig-arg">input</span>,
        <span class="sig-arg">labels</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">index</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#nd__center_of_mass">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Calculate the center of mass of the values of an array at labels.

    Labels must be None or an array of the same dimensions as the input.  

    Index must be None, a single label or sequence of labels.  If
    none, all values where label is greater than zero are used.
    
Seb: this is from scipy.ndimage, but returns ndarray and
fixes return value type &amp; shape
for the cases  len(index) == 1 and len(index) == 0

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="nd__maximum_position"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">nd__maximum_position</span>(<span class="sig-arg">input</span>,
        <span class="sig-arg">labels</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">index</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#nd__maximum_position">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Find the positions of the maximums of the values of an array at labels.

    Labels must be None or an array of the same dimensions as the input.  

    Index must be None, a single label or sequence of labels.  If
    none, all values where label is greater than zero are used.
    
Seb: this is from scipy.ndimage, but returns ndarray and
fixes return value type &amp; shape
for the cases  len(index) == 1 and len(index) == 0

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="nd__minimum_position"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">nd__minimum_position</span>(<span class="sig-arg">input</span>,
        <span class="sig-arg">labels</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">index</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#nd__minimum_position">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Find the positions of the minimums of the values of an array at labels.

    Labels must be None or an array of the same dimensions as the input.  

    Index must be None, a single label or sequence of labels.  If
    none, all values where label is greater than zero are used.
    
Seb: this is from scipy.ndimage, but returns ndarray and
fixes return value type &amp; shape
for the cases  len(index) == 1 and len(index) == 0

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="nd__sum"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">nd__sum</span>(<span class="sig-arg">input</span>,
        <span class="sig-arg">labels</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">index</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#nd__sum">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

    Calculate the sum of the values of the array.

    Parameters
    ----------

    input : array_like
        Values of `input` inside the regions defined by `labels`
        are summed together.

    labels : array of integers, same shape as input
        Assign labels to the values of the array.

    index : scalar or array
        A single label number or a sequence of label numbers of
        the objects to be measured.

    Returns
    -------

    output : list
        A list of the sums of the values of `input` inside the regions
        defined by `labels`.

    See also
    --------

    mean

    Examples
    --------

    &gt;&gt;&gt; input =  [0,1,2,3]
    &gt;&gt;&gt; labels = [1,1,2,2]
    &gt;&gt;&gt; sum(input, labels, index=[1,2])
    [1.0, 5.0]

    
Seb: this is from scipy.ndimage, but returns ndarray and
fixes return value type &amp; shape
for the cases  len(index) == 1 and len(index) == 0

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="interpolate1d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">interpolate1d</span>(<span class="sig-arg">x0</span>,
        <span class="sig-arg">y</span>,
        <span class="sig-arg">x</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#interpolate1d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>assume a function f(x) = y defined by value-pairs in y,x evaluate this
  at x=x0</p>
  <p>uses order 3 spline to do interpolation 
  [scipy.interpolate.splrep(...k=3...)</p>
  <p>note: x0 does not need to be one of the given values in x</p>
  <p>if x is None: use N.arange(len(y))</p>
  <p>more repeated evaluations this is slow - because it remakes the spline
  fit every time</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="histogram"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">histogram</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">nBins</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amin</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amax</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">histArr</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">norm</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">cumsum</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">returnTuple</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">exclude_amax</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#histogram">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

creates/returns  array with nBins int32 entries
   fills it with histogram of 'a'
if amin and/or amax is None it calculates the min/max of a and uses that
if nBins is None:
    nBins = int(amax-amin+1)
    if narr is of float dtype and nBins &lt; 100:
        nBins = 100
if histArr is given it is used to fill in the histogram values
    then nBins must be None and histArr of dtype N.int32

if norm:
   divide bins (=histArr) by sum of bins and convert to float64
if cumsum:
   calculate cumulative histogram (apply N.cumsum)
   if norm: normalize so that rightmost bin will be 1
if returnTuple:
    return (histArr, nBins, amin, amax)
if exclude_amax:
    last bin starts at amax
else:  last bin ends at amax, values equal amax are NOT counted

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="histogramXY"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">histogramXY</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">nBins</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amin</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amax</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">histArr</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">norm</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">cumsum</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">exclude_amax</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#histogramXY">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

returns flipped version of histogramYX
use this e.g. in
 Y.plotxy( U.histogramXY( a ) )


creates/returns  array with nBins int32 entries
   fills it with histogram of 'a'
if amin and/or amax is None it calculates the min/max of a and uses that
if nBins is None:
    nBins = int(amax-amin+1)
    if narr is of float dtype and nBins &lt; 100:
        nBins = 100
if histArr is given it is used to fill in the histogram values
    then nBins must be None and histArr of dtype N.int32

if norm:
   divide bins (=histArr) by sum of bins and convert to float64
if cumsum:
   calculate cumulative histogram (apply N.cumsum)
   if norm: normalize so that rightmost bin will be 1
if returnTuple:
    return (histArr, nBins, amin, amax)
if exclude_amax:
    last bin starts at amax
else:  last bin ends at amax, values equal amax are NOT counted

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="histogramYX"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">histogramYX</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">nBins</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amin</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amax</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">histArr</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">norm</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">cumsum</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">exclude_amax</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#histogramYX">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

returns same as U.histogram
but also a &quot;range array&quot; amin,...amax with nBins entries


creates/returns  array with nBins int32 entries
   fills it with histogram of 'a'
if amin and/or amax is None it calculates the min/max of a and uses that
if nBins is None:
    nBins = int(amax-amin+1)
    if narr is of float dtype and nBins &lt; 100:
        nBins = 100
if histArr is given it is used to fill in the histogram values
    then nBins must be None and histArr of dtype N.int32

if norm:
   divide bins (=histArr) by sum of bins and convert to float64
if cumsum:
   calculate cumulative histogram (apply N.cumsum)
   if norm: normalize so that rightmost bin will be 1
if returnTuple:
    return (histArr, nBins, amin, amax)
if exclude_amax:
    last bin starts at amax
else:  last bin ends at amax, values equal amax are NOT counted

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="generalhistogram"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">generalhistogram</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">weightImg</span>,
        <span class="sig-arg">nBins</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amin</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">amax</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#generalhistogram">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

creates/returns (&quot;histogram&quot;) array with nBins entries of same dtype as weightImg
while for a standard histogram one adds up 1s in bins for
      each time you encouter a certain value in a
generalhistogram  adds the pixel value found in weightImg 
      each time it encouters a certain value in a (for that pixel)

if amin and/or amax is None it calculates the min/max of a and uses that
if nBins is None:
    nBins = int(amax-amin+1)
    if a is of float dtype   and nBins &lt; 100:
         nBins = 100

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="topPercentile"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">topPercentile</span>(<span class="sig-arg">img</span>,
        <span class="sig-arg">percentile</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#topPercentile">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

find intensity for highest percentile
e.g. U.topPercentile(N.arange(10), 10) =&gt; 8
   (10% of the array is larger then 8 -- roughly)

slow!! ****** might only work for uint16 arr *********

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="rms"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">rms</span>(<span class="sig-arg">a</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#rms">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

returns root mean square (aka. the quadratic mean):
    (a**2).mean()**.5
http://en.wikipedia.org/wiki/Root_mean_square

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="project"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">project</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">axis</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#project">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>returns maximum projection along given [old: 'first'(e.g. z)] axis</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="project_lowmem"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">project_lowmem</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">mode</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">max</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">astype</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#project_lowmem">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

calc projection along axis 0
`mode`: == &quot;max&quot; -&gt; calc maximum intensity projection
        == &quot;mean&quot; -&gt; calc mean intensity projection
            (accumulation is always done using float64)    

`astype`: if not `None`, convert result before return

this function &quot;might&quot;(!) save memory and might be faster, 
because iteration over the first axis is done &quot;by hand&quot;
and does not rely on full convertion of a to an ndarray

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="insert"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">insert</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">i</span>,
        <span class="sig-arg">entry</span>,
        <span class="sig-arg">axis</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#insert">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>returns new array with new element inserted at index i along axis if 
  arr.ndim&gt;1 and if entry is scalar it gets filled in (ref. 
  broadcasting)</p>
  <p>note: (original) arr does not get affected</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="trans2d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">trans2d</span>(<span class="sig-arg">inArr</span>,
        <span class="sig-arg">outArr</span>,
        <span class="sig-arg">(tx, ty, rot, mag, gmag2_axis, gmag2)</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#trans2d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

first translates by tx,ty
THEN rotate and mag and aniso-mag
    (rotation relative to img-center !
     positive angle moves object counter-clockwise)

if outArr is None ret
NOTE: tx,ty go positive for right/up
(Bettina's Fortran goes left/down !!!) 

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="translate2d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">translate2d</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">b</span>,
        <span class="sig-arg">tx</span>,
        <span class="sig-arg">ty</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#translate2d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
shift a in to b

use bi-linear interpolation

if b is None
  output array b is allocated and returned

NOTE: tx,ty go positive for right/up
(bettina's Fortran goes left/down !!!) 

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="transmat2d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">transmat2d</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">b</span>,
        <span class="sig-arg">tx</span>,
        <span class="sig-arg">ty</span>,
        <span class="sig-arg">m11</span>,
        <span class="sig-arg">m12</span>,
        <span class="sig-arg">m21</span>,
        <span class="sig-arg">m22</span>,
        <span class="sig-arg">tx2</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">ty2</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#transmat2d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

transform a(input) into b(output) :
first translates by tx,ty
THEN apply rotate/skew
    (rotation relative to img-center !
     positive angle moves object counter-clockwise)

(m11 m12)  is the 2d transformation matrix
(m21 m22) 

use bi-linear interpolation

NOTE: tx,ty go positive for right/up
(Bettina's Fortran goes left/down !!!)

tx2,ty2 is for an extra translating ?? before OR after ?&gt;??

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="image2array"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">image2array</span>(<span class="sig-arg">im</span>,
        <span class="sig-arg">i0</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">iDelta</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">squeezeGreyRGB</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#image2array">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Convert image to numpy array

if i0 is None:
       just read next section (no im.seek !) and 
       convert and return 2d array 
if squeezeGreyRGB:
   test if an RGB (RGBA) image really just grey - 
     then return only one channel (others are identical)

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="array2image"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">array2image</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">rgbOrder</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#array2image">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Convert numpy array to image
a must be of ndim 2 and dtype UInt8,Float32 or UInt16
if a.ndim ==3:
   a.dtype must be uint8
   the first axis is interpreted as RGB color axis -- for fewer &quot;sections&quot; in a, remaining are assumed to be zero
   rgbOrder: order in which axes are mapped to RGB(A) channels

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="load"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">load</span>(<span class="sig-arg">fn</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#load">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
open any image file:
   '.fits'  - FITS files
   '.sif'   - Andor SIF files
   '.his'   - Hamamatsu HIS files
   '.spe'   - Princeton Instruments CCD image format (SPE) files
   '.lsm'   - Zeiss LSM images are read like TIFF; skipping every other slice (thumbnail)
   any image file: jpg/bmp/png/... (all PIL formats)
        #20060824 CHECK  in this case the returned arr gets attr: arr._originLeftBottom=0
   'Mrc' (use Mrc.bindFile)
   TODO: &quot;_thmb_&lt;fn.jpg&gt;&quot; files are taken to mean &lt;fn.jpg&gt;
returns image array of type ndarray_meta
        None on error

if imgFN is None  call Y.FN()  for you

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="loadImg"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">loadImg</span>(<span class="sig-arg">fn</span>,
        <span class="sig-arg">i0</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">iDelta</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">squeezeGreyRGB</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#loadImg">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Loads image file (tiff,jpg,...) and return it as array

if squeezeGreyRGB:
   test if an RGB (RGBA) image really just grey - 
     then return only one channel (others are identical)

!!be careful about up-down orientation !!

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="loadImg_seq"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">loadImg_seq</span>(<span class="sig-arg">fns</span>,
        <span class="sig-arg">channels</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">verbose</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#loadImg_seq">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Open multiple TIFF-files into a 3-(or 4-)D numpy stack.

fns is a list of filenames or a glob-expression
channels:
  specify 0 for R
          1 for G
          2 for B
          list of above for mnore than one
          None for all
  returned shape is (nz, nChannels,ny,nx) if a list/tuple was given
  returned shape is (nz, ny,nx) if a scalar was given
  if channels is None: one of the above is choosen depending on nChannels==1

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="saveImg"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">saveImg</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">fn</span>,
        <span class="sig-arg">forceMultipage</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">rgbOrder</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">format</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Saves data array as image file (format from    extension !! .tif,.jpg,...)
tries to use number format of 'arr'
also supports multipage TIFF:
    3D arrays: grey (if more than 4 z-secs or `forceMultipage`==True)
    4D arrays: color (second dim must be of len 2..4 (RG[B[A]])&quot;

for multi-color images:
     `rgbOrder`: order in which axes are mapped to RGB(A) channels
  
use `format` to spefy format (e.g. &quot;tiff&quot;) when fn is really as stream
!!be careful about up-down orientation !!

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="saveImg_seq"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">saveImg_seq</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">fn</span>,
        <span class="sig-arg">rgbOrder</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg_seq">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Saves 3D data array as 8-bit gray image file sequence (format from  extension !! .tif,.jpg,...)
filename should contain a &quot;template&quot; like %02d - use '%%' otherwise inplace of single '%'
template gets replaced with 00,01,02,03,...

for multi-color images:
     rgbOrder: order in which axes are mapped to RGB(A) channels
  
!!be careful about up-down orientation !!

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="saveImg8"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">saveImg8</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">fn</span>,
        <span class="sig-arg">forceMultipage</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">rgbOrder</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">format</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg8">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Saves data array as 8-bit gray image file (format from  extension !! .tif,.jpg,...)
be careful about up-down orientation !!
if arr.dtype is not N.uint8  arr gets rescaled to 0..255
also supports multipage TIFF:
    arr gets rescaled to 0..255 to match min..max of entire stack
    3D arrays: grey (if more than 4 z-secs or forceMultipage==True)
    4D arrays: color (second dim must be of len 2..4 (RG[B[A]])&quot;

for multi-color images:
     rgbOrder: order in which axes are mapped to RGB(A) channels
  
use `format` to specify format (e.g. &quot;tiff&quot;) when fn is really as stream
!!be careful about up-down orientation !!

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="saveImg8_seq"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">saveImg8_seq</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">fn</span>,
        <span class="sig-arg">rgbOrder</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#saveImg8_seq">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Saves 3D data array as 8-bit gray image file sequence (format from  extension !! .tif,.jpg,...)
filename must contain a &quot;template&quot; like %02d - use '%%' otherwise inplace of single '%'
template gets replaced with 00,01,02,03,...

arr gets rescaled to 0..255 to match min..max of entire stack

for multi-color images:
     rgbOrder: order in which axes are mapped to RGB(A) channels
  
!!be careful about up-down orientation !!

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="loadHIS"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">loadHIS</span>(<span class="sig-arg">fn</span>,
        <span class="sig-arg">secStart</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">secEnd</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">stride</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">mode</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#loadHIS">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

load Hamamatsu Image Sequence file format

if secStart=0, and secEnd=None, and stride=1:
   use memmap to map entire file:
   there are two cases:
      1) multiple sections have comments:
         -&gt; return mockNDarray of (memmaped) sections
      2) only the first section (may) have comments
         -&gt; map the whole file into one recarray
         NOTE(!): a.HIS.hdr[0] will be corrupt !! use a.HIS.hdr0 instead !!
otherwise OR if mode is None: 
   load given range of sections into memory 
   (using N.fromfile) and
   return mockNDarray of (in memory) sections

if secEnd is None: load section until end of file
mode: only used for case 1; 'r' open file readonly, 'r+' read-and-write
ref.: readerHIS.py

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="saveTiffMultipage"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">saveTiffMultipage</span>(<span class="sig-arg">arr</span>,
        <span class="sig-arg">fn</span>,
        <span class="sig-arg">rescaleTo8bit</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">rgbOrder</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">**params</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#saveTiffMultipage">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

extension to PIL save TIFF
if rescaleTo8bit: scale sections (using global(!) min &amp; max intesity) to 0..255
    (ratios between colors are unchanged)

**params is directly forwarded to PIL save function

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="saveTiffMultipageFromSeq"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">saveTiffMultipageFromSeq</span>(<span class="sig-arg">arrseq</span>,
        <span class="sig-arg">fn</span>,
        <span class="sig-arg">rescaleSeqTo8bit</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">rgbOrder</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">rgba</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">**params</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#saveTiffMultipageFromSeq">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

arrseq can be an iterator that yield 2D(grey) or 3D(color) image

extension to PIL save TIFF

if rescaleSeqTo8bit: scale each section (separately!) to 0..255
    (ratios between colors are unchanged)
**params is directly forwarded to PIL save function

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="calc_threshold_basic"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">calc_threshold_basic</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">histYX</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">dt</span>=<span class="sig-default">0.5</span>,
        <span class="sig-arg">nMax</span>=<span class="sig-default">100</span>,
        <span class="sig-arg">retImg</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_basic">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

calculate a threshold value
using the &quot;Basic Global Thresholding&quot; method
described in Ch. 10.3.2 in &quot;Digital Image Processing&quot;

returns threshold T (1 for a&gt;T; not &gt;=T)

stop iteration when T doesn't change more than dt
or after nMax iterations

histYX, is the histogram of a -- a tuple(binCount, binPixelValue)

if retImg:
    returns thresholded image as uint8 

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="calc_threshold_otsu"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">calc_threshold_otsu</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">histYX</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">retEM</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">retImg</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_otsu">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

calculate a threshold value
using &quot;Otsu's Method&quot;
described in Ch. 10.3.3 in &quot;Digital Image Processing&quot;

returns threshold T (1 for a&gt;T; not &gt;=T)

histYX, is the histogram of `a` -- a tuple(binCount, binPixelValue)

if retImg:
    returns thresholded image as uint8 
elif retEM: 
    returns (T, eta), where eta is the &quot;segmentation measure&quot; 
                       (which might be Matlab's &quot;effectiveness metric&quot;)

TODO FIXME: this assumes a unique maximum for s2_B; 
             otherwise an average of the corresponding T values *should* be returned

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="calc_threshold_otsu2"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">calc_threshold_otsu2</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">histYX</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">retEM</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">retImg</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_otsu2">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

calculate multiple (i.e. 2; nT = 2 !!) threshold values
using &quot;Otsu's Method&quot;
described in Ch. 10.3.6 in &quot;Digital Image Processing&quot;
Also ref.: &quot;A Fast Algorithm for Multilevel Thrsholding&quot;, Liao, Chen, Chung, 2001

################## old:returns array of nT(=2) thresholds (T1,T2)
returns tuple of T1, T2   (1 for a&gt;T; not &gt;=T)

histYX, is the histogram of a -- a tuple(binCount, binPixelValue)

if retImg:
    returns thresholded image as uint8 
elif retEM: 
    returns ((T1,T2), eta), where eta is the &quot;segmentation measure&quot; 
                             (which might be Matlab's &quot;effectiveness metric&quot;)

TODO FIXME: this assumes a unique maximum for s2_B; 
             otherwise an average of the corresponding T values *should* be returned

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="calc_threshold_otsu3"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">calc_threshold_otsu3</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">histYX</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">retEM</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">retImg</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#calc_threshold_otsu3">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

calculate 3 threshold values using &quot;Otsu's Method&quot;
described in Ch. 10.3.6 in &quot;Digital Image Processing&quot;
Also ref.: &quot;A Fast Algorithm for Multilevel Thrsholding&quot;, Liao, Chen, Chung, 2001

returns tuple of T1, T2, T3 (1 for a&gt;T; not &gt;=T)

histYX, is the histogram of a -- a tuple(binCount, binPixelValue)

if retImg:
    returns thresholded image as uint8 
elif retEM: 
    returns ((T1,T2,T3), eta), where eta is the &quot;segmentation measure&quot; 
                       (which might be Matlab's &quot;effectiveness metric&quot;)

TODO FIXME: this assumes a unique maximum for s2_B; 
             otherwise an average of the corresponding T values *should* be returned

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="saveTxt"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">saveTxt</span>(<span class="sig-arg">arrND</span>,
        <span class="sig-arg">fname</span>,
        <span class="sig-arg">fmt</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">%8.3f</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">delimiter</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"> </code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">intro</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">transpose</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#saveTxt">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

write 2D arrays as rows(-2 axis) of columns (last axis)
for each additional dimension, prepend a column for the axis index 
  (total of arrNDndim-2 additional columns)
1D arrays are written as one value per line

list of arrays are converted into mockNDarrays

fname can be one of an open file, a filename or a filename ending on &quot;.gz&quot;

start by writing intro into the file
  if intro does not end with &quot;\n&quot;, auto-append a newline

delimiter is used to separate the fields, eg delimiter ',' for
comma-separated values

if transpose: transpose last 2 dimensions of arrND before saving

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="loadTxt"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">loadTxt</span>(<span class="sig-arg">fname</span>,
        <span class="sig-arg">ndim</span>=<span class="sig-default">3</span>,
        <span class="sig-arg">dtype</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">delimiter</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">skipNlines</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">comments</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">converters</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">usecols</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#loadTxt">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

load a text file into a ndimensional array (mockNDarray)

1d arrays are columns of one line
2d arrays are multiple rows (i.e. multiple 1d lines)
higher-d arrays are like 2d arrays, where the first n-2 columns 
    are taken to be the indices for the higher dimensions

fname can be an open file or a filename or a filename ending on &quot;.gz&quot; or &quot;.bz2&quot;
if dtype is not None, force data to be dtype

delimiter is a string-like character used to seperate values in the
file. If delimiter is unspecified or none, any whitespace string is
a separator.

lines or trailing line parts starting with `comments` are ignored

converters, if not None, is a dictionary mapping column number to
a function that will convert that column to a float.  Eg, if
column 0 is a date string: converters={0:datestr2num}

usecols, if not None, is a sequence of integer column indexes to
extract where 0 is the first column, eg usecols=(1,4,5) to extract
just the 2nd, 5th and 6th columns

after applying converters (at first) and usecols (after that),
the first ndim-2 columns are interpreted as the nd-index

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="text2array"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">text2array</span>(<span class="sig-arg">txt</span>,
        <span class="sig-arg">transpose</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">comment</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">sep</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">convFcn</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">skipNlines</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">convertDecimalKomma</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#text2array">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Return an array containing the data contained as text in txt. This
function works for arbitrary data types (every array element can be
given by an arbitrary Python expression), but at the price of being
slow. 

if convFcn is not None:
    convFcn is called for each &quot;cell&quot; value - a string !.
    useful here: &quot;N.float32&quot;  # WRONG !! THIS DOES NOT WORK FIXME !
else:
    &quot;eval&quot; is called for each cell

if sep is None, any white space is seen as field separator
ignore all lines that start with any character contained in comment

if convertDecimalKomma:
   convert e.g. &quot;10,2&quot; to &quot;10.2&quot;

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="grep"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">grep</span>(<span class="sig-arg">pattern</span>,
        <span class="sig-arg">*files</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#grep">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

emulate grep-functionality

#if retList:
    return tuple list of (file, lineNo, lineText)-tuple
#else:
#    print familiar output to stdout

posted by Fredrik Lundh, October 25th, 2005
http://bytes.com/forum/thread169012.html

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="path_mkdir"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">path_mkdir</span>(<span class="sig-arg">newdir</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#path_mkdir">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

works the way a good mkdir should :)
- already exists, silently complete
- regular file in the way, raise an exception
- parent directory(ies) does not exist, make them as well

Recipe 82465: a friendly mkdir() 
http://code.activestate.com/recipes/82465/

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="binaryRepr"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">binaryRepr</span>(<span class="sig-arg">x</span>,
        <span class="sig-arg">count</span>=<span class="sig-default">8</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#binaryRepr">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Integer to &quot;binary string&quot; (&quot;101011&quot;) returns 
  string of length count containing '0's and '1' building up the 
  &quot;binary representation&quot; of x Count is number of bits</p>
  <p>Note: the inverse operation is done by int(xxx, 2)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="deco_simple_decorator"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">deco_simple_decorator</span>(<span class="sig-arg">decorator</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#deco_simple_decorator">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>This decorator can be used to turn simple functions into well-behaved 
  decorators, so long as the decorators are fairly simple. If a decorator 
  expects a function and returns a function (no descriptors), and if it 
  doesn't modify function attributes or docstring, then it is eligible to 
  use this. Simply apply @simple_decorator to your decorator and it will 
  automatically preserve the docstring and function attributes of functions
  to which it is applied.</p>
  <p>from  http://wiki.python.org/moin/PythonDecoratorLibrary</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="deco_addInstanceMethodTo"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">deco_addInstanceMethodTo</span>(<span class="sig-arg">instance</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#deco_addInstanceMethodTo">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Easy adding methods to a class instance</p>
  <p>from  http://wiki.python.org/moin/PythonDecoratorLibrary</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fib2"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fib2</span>(<span class="sig-arg">n</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#fib2">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>direct calc (non-recursive) return n_th Fibonacci number (as float!) 
  n=0 --&gt; 0 n=1 --&gt; 1 n=2 --&gt; 1 ... n should be &lt;= 604 ;-( (as 
  float) n should be &lt;= 46  ;-( (if you want to convert to int) 
  #http://en.wikipedia.org/wiki/Fibonacci_sequence # 
  http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=A000045</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="primeFactors"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">primeFactors</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">max</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">includeRemainder</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#primeFactors">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
return list of a's prime factors
if max is not None:
   largest prime in list will be max
    (as often as it would be in the complete list)
   in this case: if includeRemainder is True:
                 append remainder so that N.product(&lt;list&gt;) == a

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="gamma"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">gamma</span>(<span class="sig-arg">x</span>,
        <span class="sig-arg">_memo</span>=<span class="sig-default"><code class="variable-group">{</code>0.5<code class="variable-op">: </code>1.77245385091<code class="variable-op">, </code>1.0<code class="variable-op">: </code>1.0<code class="variable-group">}</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#gamma">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>return gamma function defined for integer and half-integer values</p>
  <p>you can use scipy.special.gamma() for the general case</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="smooth1d"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">smooth1d</span>(<span class="sig-arg">x</span>,
        <span class="sig-arg">window_len</span>=<span class="sig-default">10</span>,
        <span class="sig-arg">window</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">hanning</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#smooth1d">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
smooth the data using a window with requested size.

This method is based on the convolution of a scaled window with the signal.
The signal is prepared by introducing reflected copies of the signal 
(with the window size) in both ends so that transient parts are minimized
in the begining and end part of the output signal.

input:
    x: the input signal 
    window_len: the dimension of the smoothing window
    window: the type of window from 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'
        flat window will produce a moving average smoothing.

output:
    the smoothed signal
    
(ref.: copy paste from http://www.scipy.org/Cookbook/SignalSmooth)
example:

t=linspace(-2,2,0.1)
x=sin(t)+randn(len(t))*0.1
y=smooth(x)

see also: 

numpy.hanning, numpy.hamming, numpy.bartlett, numpy.blackman, numpy.convolve
scipy.signal.lfilter

TODO: the window parameter could be the window itself if an array instead of a string   

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="unique"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">unique</span>(<span class="sig-arg">s</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#unique">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return a list of the elements in s, but without duplicates.</p>
  <p>For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], 
  unique(&quot;abcabc&quot;) some permutation of [&quot;a&quot;, 
  &quot;b&quot;, &quot;c&quot;], and unique(([1, 2], [2, 3], [1, 2])) some 
  permutation of [[2, 3], [1, 2]].</p>
  <p>For best speed, all sequence elements should be hashable.  Then 
  unique() will usually work in linear time.</p>
  <p>If not possible, the sequence elements should enjoy a total ordering, 
  and if list(s).sort() doesn't raise TypeError it's assumed that they do 
  enjoy a total ordering.  Then unique() will usually work in O(N*log2(N)) 
  time.</p>
  <p>If that's not possible either, the sequence elements must support 
  equality-testing.  Then unique() will usually work in quadratic time.</p>
  <p>http://code.activestate.com/recipes/52560 by Tim Peters</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="flatten"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">flatten</span>(<span class="sig-arg">sequence</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#flatten">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Returns a single, flat list which contains all elements retrieved
from the sequence and all recursively contained sub-sequences
(iterables).

there are three different modes (semantic variations):
   &quot;listsOnly&quot;: flatten lists only, leave sub-tuples and other sub-seqs in tact
   &quot;tuplesAlso&quot;: flatten lists and tuples, leave other sub-seqs (like arrays) in tact
   &quot;all&quot;: flatten all interables into one flat lists
(only the first letters, &quot;lis&quot;, &quot;tup&quot;, &quot;all&quot; are significant !)

Examples:
&gt;&gt;&gt; [1, 2, [3,4], (5,6)]
[1, 2, [3, 4], (5, 6)]
&gt;&gt;&gt; U.flatten(_)
[1, 2, 3, 4, (5, 6)]
&gt;&gt;&gt; flatten([[[1,2,3], (42,None)], [4,5], [6], 7, U.arrI(8,9,10)], mode='all')
[1, 2, 3, 42, None, 4, 5, 6, 7, 8, 9, 10]

(inspired by http://kogs-www.informatik.uni-hamburg.de/~meine/python_tricks)

</pre>
  <dl class="fields">
    <dt>Returns: list</dt>
  </dl>
</td></tr></table>
</div>
<a name="hexdump"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">hexdump</span>(<span class="sig-arg">s</span>,
        <span class="sig-arg">numsPerLine</span>=<span class="sig-default">16</span>,
        <span class="sig-arg">ret</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#hexdump">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>dump any kind of string, ascii, encoded, or unicode, using the 
  standard hex dump output format. This is similar to the unix `hexdump` 
  command.</p>
  <p>print `numsPerLine` characters (numbers!) per line. (for unicode each 
  char counts as 2)</p>
  <p>if `ret` is False: print dump to stddout else return it as string</p>
  <p>(inspired by http://code.activestate.com/recipes/572181/)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="zip_extractall"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">zip_extractall</span>(<span class="sig-arg">fn</span>,
        <span class="sig-arg">outDir</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">percent</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">verbose</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#zip_extractall">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

extract zip file into a directory (default to current working dir)

if verbose: print line for each file extracted
else(!) if percent&gt;0: print note every `percent` increments
        (measured by total number of files to be extracted)

(inspired by http://code.activestate.com/recipes/252508 By Doug Tolton)
(in Python 2.6 this will be zipfile.extractall())

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="zip_zipDir"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">zip_zipDir</span>(<span class="sig-arg">fn</span>,
        <span class="sig-arg">dir</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.useful-pysrc.html#zip_zipDir">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>create new zip archive with filename `fn` and put everything inside 
  directory `dir` into it</p>
  <p>(inspired by 
  http://coreygoldberg.blogspot.com/2009/07/python-zip-directories-recursively.html)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-VariablesDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="_U_nd_extra_doc_"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">_U_nd_extra_doc_</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
<code class="variable-quote">'''</code><code class="variable-string"></code>
<code class="variable-string">Seb: this is from scipy.ndimage, but returns ndarray and</code>
<code class="variable-string">fixes return value type &amp; shape</code>
<code class="variable-string">for the cases  len(index) == 1 and len(index) == 0</code>
<code class="variable-string"></code><code class="variable-quote">'''</code>
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Priithon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/priithon">Priithon</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Nov 22 14:59:33 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
